import request from '/@/utils/request';

/**
 * 
 * @returns 菜单管理
 */
export function menuPermissionApi() {
	return {
		getMenuAll: (params?: object) => {
			return request({
				url: '/sys/menu/menuAll',
				method: 'get',
				params,
			});
		},
		edit: (params: object) => {
			return request({
				url: '/sys/permission/edit',
				method: 'post',
				data: params,
			});
		},
		add: (params: object) => {
			return request({
				url: '/sys/permission/add',
				method: 'post',
				data: params,
			});
		},
		delete: (params: object) => {
			return request({
				url: '/sys/permission/delete',
				method: 'get',
				params,
			});
		},
		getPersionIdsByRoleId: (params: object) => {
			return request({
				url: '/sys/rolePermission/getPersionIdsByRoleId',
				method: 'get',
				params,
			});
		},
	};
}

/**
 * 
 * @returns 用户管理
 */
export function userApi() {
	return {
		list: (params: object) => {
			return request({
				url: '/sys/user/list',
				method: 'get',
				params,
			});
		},
		delete: (params: object) => {
			return request({
				url: '/sys/user/delete',
				method: 'get',
				params,
			});
		},
		add: (params: object) => {
			return request({
				url: '/sys/user/add',
				method: 'post',
				data: params,
			});
		},
		edit: (params: object) => {
			return request({
				url: '/sys/user/edit',
				method: 'post',
				data: params,
			});
		},
	};
}


/**
 * 
 * @returns 部门管理
 */
 export function departmentApi() {
	return {
		list: (params: object) => {
			return request({
				url: '/sys/department/listTree',
				method: 'get',
				params,
			});
		},
		delete: (params: object) => {
			return request({
				url: '/sys/department/delete',
				method: 'get',
				params,
			});
		},
		add: (params: object) => {
			return request({
				url: '/sys/department/add',
				method: 'post',
				data: params,
			});
		},
		edit: (params: object) => {
			return request({
				url: '/sys/department/edit',
				method: 'post',
				data: params,
			});
		},
	};
}

/**
 * 
 * @returns 角色管理
 */
 export function rolesApi() {
	return {
		list: (params: object) => {
			return request({
				url: '/sys/role/list',
				method: 'get',
				params,
			});
		},
		delete: (params: object) => {
			return request({
				url: '/sys/role/delete',
				method: 'get',
				params,
			});
		},
		add: (params: object) => {
			return request({
				url: '/sys/role/add',
				method: 'post',
				data: params,
			});
		},
		edit: (params: object) => {
			return request({
				url: '/sys/role/edit',
				method: 'post',
				data: params,
			});
		},
		getRoles: () => {
			return request({
				url: '/sys/role/getRoles',
				method: 'get',
			});
		},
		getRoleIdsByUserId: (params: object) => {
			return request({
				url: '/sys/userRole/getRoleIdsByUserId',
				method: 'get',
				params,
			});
		},
	};
}